(function() {
  var dialog = Alchemy.currentDialog();
  var callback = function() {
    Turbo.visit('<%= url_for(@redirect_url).html_safe %>');
  };
  if (dialog) {
    Alchemy.closeCurrentDialog(callback);
  } else {
    callback();
  }
})();
